/*
 * Copyright rgil2010
 * All rights reserved
 */

package com.test.gui.swing.components.panel;

import com.toedter.calendar.JDateChooser;
import java.util.Date;
import javax.swing.GroupLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author user
 */
public class lbzHrzDateChooser extends JPanel {
    public lbzHrzDateChooser(String strText, int length){

        initializeComponents(strText, length);

    }
    private void initializeComponents(String strText, int length)
    {
        this.lblChamp = new JLabel();
        this.dateChooser = new JDateChooser();
        
        this.lblChamp.setText(strText + " :");
       
        GroupLayout layout = new GroupLayout(this);
        this.setLayout(layout);
        this.setLayout(layout);

        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(this.lblChamp)
                .addGap(length, length, length)
                .addComponent(this.dateChooser, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
            )
        );

        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(this.lblChamp)

                    .addComponent(this.dateChooser, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                )
            )
        );
    }
    private JLabel lblChamp;
    private JDateChooser dateChooser;

    public String getDate() {

        Date date = dateChooser.getDate();

        String str = "";//= date.toString();
       
        System.out.println("intDate : "  + str);
        return "";
    }

}
